/**

 @author 石头哥哥
 </P>
 Date:   2014/12/23
 </P>
 Time:   17:35

 注解：

 */
package GameObject {
import lzm.starling.STLConstant;

import starling.animation.Tween;
import starling.core.Starling;
import starling.display.Image;
import starling.display.Sprite;

import utils.Kit;

/**
 * 炸弹对象
 */
public class Bomb extends Sprite {

    private var _moveTween:Tween=null;

    public function Bomb() {
        super();

         Init();
    }

    /**
     *
     */
    private function Init():void {
        var bombImage:Image = new Image(GameSystem.assetManager.getTexture("ufo2"));
        addChild(bombImage);

        var mind:Number = STLConstant.StageWidth - this.width;
        this.x = Kit.Rnd(0, mind);
        this.y = 0;
        _moveTween = new Tween(this, (STLConstant.StageHeight + 100) / 60);
        _moveTween.moveTo(this.x, STLConstant.StageHeight + 10);//MOVED 1290
        Starling.juggler.add(_moveTween);

        _moveTween.onComplete=function():void{
            Starling.juggler.removeTweens(_moveTween);
        }
    }


    /**
     *
     * @param dispose
     */
    public function clear(dispose:Boolean = false):void {
       removeFromParent(dispose);
        //move
        if (_moveTween)Starling.juggler.remove(_moveTween);
        this.dispose();
    }

    /**
     * 停止游戏
     */
    public function pause():void {
        //move
        if (_moveTween)Starling.juggler.remove(_moveTween);
    }

    /**
     * 恢复游戏状态
     */
    public function reuse():void {
        //move
        if (_moveTween)Starling.juggler.add(_moveTween);
    }


}
}
